package com.ruoyi.module.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.module.domain.WebCategory;
import com.ruoyi.module.mapper.WebCategoryMapper;
import com.ruoyi.module.service.IWebCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 分类Service业务层处理
 *
 * @author fubojin
 * @date 2024-12-09
 */
@Service
public class WebCategoryServiceImpl implements IWebCategoryService
{
    @Autowired
    private WebCategoryMapper webCategoryMapper;

    /**
     * 查询分类
     *
     * @param id 分类主键
     * @return 分类
     */
    @Override
    public WebCategory selectWebCategoryById(Long id)
    {
        return webCategoryMapper.selectWebCategoryById(id);
    }

    /**
     * 查询分类列表
     *
     * @param webCategory 分类
     * @return 分类
     */
    @Override
    public List<WebCategory> selectWebCategoryList(WebCategory webCategory)
    {
        return webCategoryMapper.selectWebCategoryList(webCategory);
    }

    /**
     * 新增分类
     *
     * @param webCategory 分类
     * @return 结果
     */
    @Override
    public int insertWebCategory(WebCategory webCategory)
    {
        webCategory.setCreateTime(DateUtils.getNowDate());
        return webCategoryMapper.insertWebCategory(webCategory);
    }

    /**
     * 修改分类
     *
     * @param webCategory 分类
     * @return 结果
     */
    @Override
    public int updateWebCategory(WebCategory webCategory)
    {
        webCategory.setUpdateTime(DateUtils.getNowDate());
        return webCategoryMapper.updateWebCategory(webCategory);
    }

    /**
     * 批量删除分类
     *
     * @param ids 需要删除的分类主键
     * @return 结果
     */
    @Override
    public int deleteWebCategoryByIds(Long[] ids)
    {
        return webCategoryMapper.deleteWebCategoryByIds(ids);
    }

    /**
     * 删除分类信息
     *
     * @param id 分类主键
     * @return 结果
     */
    @Override
    public int deleteWebCategoryById(Long id)
    {
        return webCategoryMapper.deleteWebCategoryById(id);
    }
}
